package com.zline.foodraise.view;

import android.content.Context;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.zline.foodraise.R;
import com.zline.foodraise.entity.City;
import com.zline.foodraise.listener.RecyclerItemClicked;

import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EViewGroup;
import org.androidannotations.annotations.ViewById;

/**
 * Created by heshantao on 15/7/13.
 * 所在地列表Item(城市)
 */
@EViewGroup(R.layout.choose_location_list_item)
public class ChooseCityListItem extends RelativeLayout{
    private static final String LOG_TAG= ChooseCityListItem.class.getSimpleName();
    @ViewById(R.id.location_list_item_tv)
    TextView name_tv;
    RecyclerItemClicked itemClicked;
    int position;
    public ChooseCityListItem(Context context) {
        super(context);
    }

    public void bind(City city,int position){
        this.position=position;
        name_tv.setText(city.getCityName());
    }

    public  void  setRecycleItemListener(RecyclerItemClicked recycleItemListener){
        this.itemClicked=recycleItemListener;
    }


    @Click(R.id.location_list_item_rl)
    void onClick(){
        itemClicked.onRecyclerItemClicked(position);
    }
}
